<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>评审专家信息管理</title>
	<meta name="decorator" content="default"/>
	<script src="${ctxStatic}/jquery-validation/1.11.0/jquery.validate.method.js" type="text/javascript"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				rules:{
					card:{
						card:true
						/* remote:{
							url:"${ctx}/zx/expertsInfo/expertIsExist",
						 	data: {                     //要传递的数据
							 card: function() {
                                    return $("#card").val();
                                }
                            }
						} */
					},
					phone:{
						remote:{
							url:"${ctx}/zx/expertsInfo/phoneIsExist",
						 	data: {                     //要传递的数据
						 		phone: function() {
                                    return $("#phone").val();
                                },
                                name: function() {
                                    return $("#name").val();
                                }
                            }
						}
					}
					
				},
				messages:{
					phone:{
						remote:"专家信息已存在"
					}
					/* card:{
						remote:"专家信息已存在"
					} */
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			// 初始化计算
			$("#ageText").val(analyzeIDCard('${expertsInfo.card}').age);
			
			$("#card").blur(function(){
				
				if(checkIdcard($(this).val())){
					$("#ageText").val(analyzeIDCard($(this).val()).age);
				}
				
			});
		});
		
		
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/zx/expertsInfo/">评审专家信息列表</a></li>
		<li class="active"><a href="${ctx}/zx/expertsInfo/form?id=${expertsInfo.id}">评审专家信息<shiro:hasPermission name="zx:experts:edit">${not empty expertsInfo.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="zx:experts:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="expertsInfo" action="${ctx}/zx/expertsInfo/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>		
		<div class="control-group">
			<label class="control-label">专家姓名：</label>
			<div class="controls">
				<form:input path="name" htmlEscape="false" maxlength="100" class="input-xlarge required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">手机号码：</label>
			<div class="controls">
				<form:input path="phone" htmlEscape="false" maxlength="100" class="input-xlarge required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">身份证号码：</label>
			<div class="controls">
				<form:input path="card" htmlEscape="false" maxlength="100" class="input-xlarge"/>
				<!-- <span class="help-inline"><font color="red">*</font> </span> -->
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">分类：</label>
			<div class="controls">
				<sys:treeselect id="expertsType" name="expertsType.id" value="${expertsInfo.expertsType.id}" labelName="expertsType.name" labelValue="${expertsInfo.expertsType.name}" 
				title="专家分类" url="/zx/expertsType/treeData?type=2" cssClass="input-small required" allowClear="true" notAllowSelectParent="true"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">性别：</label>
			<div class="controls">
				<%-- <form:input path="sex" htmlEscape="false" maxlength="1" class="input-xlarge "/> --%>
				<form:select path="sex">
					<form:options items="${fns:getDictList('sex')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">生日：</label>
			<div class="controls">
				<input name="birthday" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate zx-input"
					value="<fmt:formatDate value="${expertsInfo.birthday}" pattern="yyyy-MM-dd"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">参与评标专业：</label>
			<div class="controls">
				<form:input path="bep" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">职称：</label>
			<div class="controls">
				<form:input path="positional" htmlEscape="false" maxlength="100" class="input-xlarge required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		
		<%-- <div class="control-group">
			<label class="control-label">学位：</label>
			<div class="controls">
				<form:input path="degree" htmlEscape="false" maxlength="100" class="input-xlarge "/>
			</div>
		</div> --%>
		
		
		<div class="control-group">
			<label class="control-label">专家年龄：</label>
			<div class="controls">
				<input disabled="true" id="ageText" htmlEscape="false" maxlength="100" class="input-xlarge zx-input" />
				<label style="padding-left: 5px;padding-bottom: 2px;font-weight: bold;color: #ea5200;margin-left: 10px;">年龄会根据身份证号码自动算出</label>
			</div>
		</div>
		<%-- <div class="control-group">
			<label class="control-label">工作年限：</label>
			<div class="controls">
				<form:input path="workYear" htmlEscape="false" maxlength="100" class="input-xlarge "/>
			</div>
		</div> --%>
		<div class="control-group">
			<label class="control-label">专家评价：</label>
			<div class="controls">
				<form:select path="evaluateGrade">
					<form:options items="${fns:getDictList('evaluate_grade')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">评价内容：</label>
			<div class="controls">
				<form:textarea path="evaluateContent" htmlEscape="false" rows="4" maxlength="255" class="input-xxlarge required"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">备注信息：</label>
			<div class="controls">
				<form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="255" class="input-xxlarge"/>
			</div>
		</div>
		<div class="form-actions">
			<shiro:hasPermission name="zx:experts:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>